<?php

use App\Http\Controllers\Common\ConfigController;
use App\Http\Controllers\Common\ShortUrlController;
use App\Http\Controllers\OpenShop\Feishu\OrganizationManageController;
use Illuminate\Support\Facades\Route;

Route::get('ping', function () { return 'pong'; });

Route::group(['middleware' => \App\Http\Middleware\InternalApiAuth::class], function () {

    // 开店
    Route::prefix('openShop')->group(function () {
        // 获取用户组织
        Route::get('organizationManage/userOrganization', [OrganizationManageController::class, "userOrganization"]);
        //组织列表
        Route::get('organizationManage/list', [OrganizationManageController::class, "organizationManageList"]);

        // 更新门店督导
        Route::post('changeManager',
            [\App\Http\Controllers\Internal\OpenShop\SignOrderController::class, "changeManager"]);

        // 获取门店的managers
        Route::get('getShopManagers', [OrganizationManageController::class, "getShopManagers"]);

        // 开店对账单下载
        Route::post('downloadPayDetail', [\App\Http\Controllers\Internal\OpenShop\PayController::class, 'downloadPayDetail']);

        // 获取开店订单的门店
        Route::get('getShops', [OrganizationManageController::class, 'getShops']);
    });

    // shop
    Route::prefix('shop')->group(function () {

        // 订货比查询
        Route::get('orderRatio', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'orderRatio']);

        // 最后巡店时间
        Route::get('lastCruiseTime', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'lastCruiseTime']);

        // 获取店铺省总
        Route::get('getOrganizationInfo', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'getOrganizationInfoByType']);

        // 批量获取店铺的开店阶段
        Route::get('nowStepStatus', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'nowStepStatus']);

        // rms shopLists辅助接口
        Route::post('shopListsSub', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'shopListsSub']);

        // 根据shopId获得门店培训校区
        Route::get('getTrainSchool', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'getTrainSchool']);

        // 根据门店ID门店属性
        Route::get('getShopPatternByShopId', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'getShopPatternByShopId']);

        // 根据门店ID查询门店属性
        Route::get('getShopAttributeByShopIds', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'getShopAttributeByShopIds']);

        // 根据ShopCode获得开店订单手机号（老板）
        Route::get('getShopMobileByShopCode', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'getShopMobileByShopCode']);

        // 根据稽核人员id查询对应门店区域
        Route::get('getShopCruiseManageArea', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'getShopCruiseManageArea']);

        // 根据云巡店-稽核日期查询对应门店id
        Route::get('getShopIdsByTourCruise', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'getShopIdsByTourCruise']);

        Route::get('getShopLicenseStatus', [\App\Http\Controllers\Internal\Shop\ShopController::class, 'getShopLicenseStatus']);
    });

    // user
    Route::prefix('user')->group(function () {

        // fs_company_users
        Route::get('fsCompanyUser', [\App\Http\Controllers\Common\FsUserController::class, "getFsCompanyUsers"]);

        // 根据门店ID和用户ID获得用户是否有群聊权限
        Route::get('getChatGroupIdByUser', [\App\Http\Controllers\Internal\User\UserController::class, "getChatGroupIdByUser"]);

        // 飞书小程序中间件校验
        Route::get('fsMiniTokenAuth', [\App\Http\Controllers\Internal\User\UserController::class, "fsMiniTokenAuth"]);

        // 判断userId是否属于三方机构人员
        Route::get('checkCruiseCheckUser', [\App\Http\Controllers\Internal\User\UserController::class, "checkCruiseCheckUser"]);
    });

    // company
    Route::prefix('company')->group(function () {

        // add fs_company
        Route::post('addFsCompany', [\App\Http\Controllers\Internal\Company\FsCompanyController::class, 'addFsCompany']);
    });


    // common
    Route::prefix('common')->group(function () {
        //生成短链
        Route::post('generateShortLinkUrl', [ShortUrlController::class, "generateShortUrl"]);

        // 获取表的最大id
        Route::get('getMaxId', [\App\Http\Controllers\Common\CommonController::class, 'getMaxId']);

        // 获取某个日期是否是工作日
        Route::get('getWorkDateByDays', [\App\Http\Controllers\Common\CommonController::class, 'getWorkDateByDays']);

        //获取配置信息
        Route::get('getConfigDetail', [ConfigController::class, 'getConfigContent']);

        // 消息tab
        Route::get('getUserNotifyList', [\App\Http\Controllers\Internal\System\SystemNotifyController::class, 'getUserNotifyList']);

        //获取战区+省区
        Route::get('getWarZoneDistrictList', [\App\Http\Controllers\Internal\Common\WarZoneController::class, 'getWarZoneDistrictList']);
    });

    // 机器人消息
    Route::prefix('robot')->group(function () {

        // web-hock，卡片消息
        Route::post('webHockCardMessage', [\App\Http\Controllers\Common\RobotController::class, 'webHockCardMessage']);

        // 通过platformName & feishuId获取appId/appSecret
        Route::get('getFsConfigByPlatformNameFeiShuId', [\App\Http\Controllers\Common\RobotController::class, 'getFsConfigByPlatformNameFeiShuId']);

        // 通过userId获取供应商的feishuId
        Route::get('getFeiShuIdByUserIdsExt', [\App\Http\Controllers\Common\RobotController::class, 'getFeiShuIdByUserIdsExt']);
    });

    Route::prefix('cruise')->group(function () {

        // 待处理的违约函
        Route::get('getAgainstIds', [\App\Http\Controllers\Cruise\Internal\CruiseCheckController::class, 'getAgainstIds']);

        // 删除网商表单
        Route::post('delMyBankInput', [\App\Http\Controllers\Cruise\Internal\MybankController::class, 'delMyBankInput']);
    });

    // 系统
    Route::group(['prefix' => 'system', 'namespace' => 'System'], function () {
        // 系统推送
        Route::post('systemNotify/customerBatchPush', [\App\Http\Controllers\Internal\System\SystemNotifyController::class, "customerBatchPush"]);
        //开通网商银行推送预览
        Route::post('openBankPay', [\App\Http\Controllers\OpenShop\Notify\SystemNotifyController::class, 'prePush']);
    });

    // 评价
    Route::group(['prefix' => 'appraise'], function () {
        // 通过业务订单ID和类型查询详情
        Route::get('getInfoByOrderNos', [\App\Http\Controllers\WorkOrder\Internal\AppraiseController::class, "getInfoByOrderNos"]);
        // 日常运营阶段 饿了么外卖上线&美团外卖上线「需推送」 点评团购上线&抖音团购上线「需推送」 其中一个平台，上线团购2周后
        Route::post('eventNotify', [\App\Http\Controllers\WorkOrder\Internal\AppraiseController::class, "eventNotify"]);
    });

    // 发票
    Route::group(['prefix' => 'invoice'], function () {
        Route::get('invoiceList', [\App\Http\Controllers\Invoice\Internal\InvoiceController::class, "invoiceList"]);
    });

    // 文章
    Route::group(['prefix' => 'article'], function () {

        // 商家内容数据
        Route::get('articleTop', [\App\Http\Controllers\Article\Internal\ArticleController::class, 'articleTop']);
    });
});



